<template>
  <div>
    <el-card>
      <h1 style="font-weight:700;font-size:24px">信息查询</h1>
      <el-divider></el-divider>
      <el-tabs v-model="activeName">
        <el-tab-pane label="小区查询" name="first">
          <div>
            <el-form ref="form" :model="ss1" label-width="80px" :inline="true">
              <el-form-item label="户主">
                <el-input v-model="ss1.zhanghao" style="width: 260px;"></el-input>
              </el-form-item>
              <el-form-item label="小区">
                <el-select v-model="ss1.xiaoqu" placeholder="请选择">
                  <el-option label="请选择" value=""></el-option>
                  <el-option v-for="item in list1" :key="item._id" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div style="margin-left: 400px;">
              <el-button @click="chongzhi()">重置</el-button>
              <el-button style="background-color: #394E9E;color:white" @click="getdata()">查询</el-button>
            </div>
          </div>
          <el-table v-show="rid == '65f12041caadbc7190c137b9'" ref="multipleTable" :data="list1" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="name" label="小区名">
            </el-table-column>
            <el-table-column prop="address" label="校区地址">
            </el-table-column>
            <el-table-column prop="kfs" label="小区开发商">
            </el-table-column>
            <el-table-column prop="wuye" label="小区物业">
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-table v-show="rid == '65f8dd051c78378ca710a242'" ref="multipleTable" :data="list11" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="name" label="小区名">
            </el-table-column>
            <el-table-column prop="address" label="校区地址">
            </el-table-column>
            <el-table-column prop="kfs" label="小区开发商">
            </el-table-column>
            <el-table-column prop="wuye" label="小区物业">
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="房屋查询" name="second">
          <div>
            <el-form ref="form" :model="ss2" label-width="80px" :inline="true">
              <el-form-item label="户主">
                <el-input v-model="ss2.huzhu" style="width: 260px;"></el-input>
              </el-form-item>
              <el-form-item label="小区">
                <el-select v-model="ss2.xiaoqu" placeholder="请选择">
                  <el-option label="请选择" value=""></el-option>
                  <el-option v-for="item in list1" :key="item._id" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div style="margin-left: 400px;">
              <el-button @click="chongzhi()">重置</el-button>
              <el-button style="background-color: #394E9E;color:white" @click="getwuzi()">查询</el-button>
            </div>
          </div>
          <el-table ref="multipleTable" :data="list2" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="doorid" label="门牌号">
            </el-table-column>
            <el-table-column label="房屋面积">
              <template scope="scope">
                <span>{{ scope.row.mianji | mianji }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="huzhu" label="户主">
            </el-table-column>
            <el-table-column prop="xiaoqu" label="所属小区">
            </el-table-column>
            <el-table-column prop="time" label="建档日期">
              <template scope="scope">
                {{ scope.row.time | shijian }}
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="人员查询" name="third">
          <div>
            <el-form ref="form" :model="ss3" label-width="80px" :inline="true">
              <el-form-item label="姓名">
                <el-input v-model="ss3.name" style="width: 130px;"></el-input>
              </el-form-item>
              <el-form-item label="性别">
                <el-input v-model="ss3.sex" style="width: 130px;"></el-input>
              </el-form-item>
              <el-form-item label="所属小区">
                <el-select v-model="ss3.xiaoqu" placeholder="请选择">
                  <el-option label="请选择" value=""></el-option>
                  <el-option v-for="item in list1" :key="item._id" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div style="margin-left: 400px;">
              <el-button @click="chongzhi()">重置</el-button>
              <el-button style="background-color: #394E9E;color:white" @click="getren()">查询</el-button>
            </div>
          </div>
          <el-table v-show="rid == '65f12041caadbc7190c137b9'"  ref="multipleTable" :data="list3" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="name" label="姓名">
            </el-table-column>
            <el-table-column prop="sex" label="性别">
            </el-table-column>
            <el-table-column prop="phone" label="联系方式">
            </el-table-column>
            <el-table-column prop="xiaoqu" label="住址">
            </el-table-column>
            <el-table-column prop="time" label="建档日期">
              <template scope="scope">
                {{ scope.row.time | shijian }}
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-table v-show="rid == '65f8dd051c78378ca710a242'"  ref="multipleTable" :data="list33" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="name" label="姓名">
            </el-table-column>
            <el-table-column prop="sex" label="性别">
            </el-table-column>
            <el-table-column prop="phone" label="联系方式">
            </el-table-column>
            <el-table-column prop="xiaoqu" label="住址">
            </el-table-column>
            <el-table-column prop="time" label="建档日期">
              <template scope="scope">
                {{ scope.row.time | shijian }}
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="车辆查询" name="fourth">
          <div>
            <el-form ref="form" :model="ss4" label-width="80px" :inline="true">
              <el-form-item label="车牌号">
                <el-input v-model="ss4.carid" style="width: 130px;"></el-input>
              </el-form-item>
              <el-form-item label="车主">
                <el-input v-model="ss4.ren" style="width: 130px;"></el-input>
              </el-form-item>
              <el-form-item label="小区">
                <el-select v-model="ss4.xiaoqu" placeholder="请选择">
                  <el-option label="请选择" value=""></el-option>
                  <el-option v-for="item in list1" :key="item._id" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div style="margin-left: 400px;">
              <el-button @click="chongzhi()">重置</el-button>
              <el-button style="background-color: #394E9E;color:white" @click="getcar()">查询</el-button>
            </div>
          </div>
          <el-table ref="multipleTable" :data="list4" tooltip-effect="dark" style="width: 100%"
            @selection-change="selone">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="carid" label="车牌号">
            </el-table-column>
            <el-table-column prop="ren" label="车主">
            </el-table-column>
            <el-table-column prop="color" label="车身颜色">
            </el-table-column>
            <el-table-column prop="xiaoqu" label="所属小区">
            </el-table-column>
            <el-table-column prop="time" label="建档日期">
              <template scope="scope">
                {{ scope.row.time | shijian }}
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template>
                <el-button style="background-color: #394E9E;color:white">编辑</el-button>
                <el-button style="background-color: #394E9E;color:white">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
export default {
  filters: {
    mianji: function (value) {
      return value + 'm²'
    }
  },
  data() {
    return {
      activeName: 'first',
      list1: [],
      list11:[],
      se1: [],
      list2: [],
      list3: [],
      list33:[],
      list4: [],
      rolelist: [],
      ssform: {
        zhanghao: '',
        name: '',
        roleid: '',
        data: '',
      },
      ss1: {

      },
      ss2: {
        huzhu: '',
        xiaoqu: ''
      },
      ss3: {
        name: '',
        sex: '',
        xiaoqu: ''
      },
      ss4: {
        carid: '',
        ren: '',
        xiaoqu: '',
      },
      rid:''
    }
  },
  methods: {
    async getrole() {
      let { data } = await this.axios.get('/rolelist')
      this.rolelist = data.rolelist
    },

    async getwuzi() {
      this.rid = JSON.parse(sessionStorage.getItem("list")).roleid
      let { data } = await this.axios.get('/wuzilist', { params: { xiaoqu: this.ss2.xiaoqu, huzhu: this.ss2.huzhu } })
      this.list2 = data.wuzilist
    },
    async getcar() {
      let { data } = await this.axios.get('/carlist', { params: { xiaoqu: this.ss4.xiaoqu, ren: this.ss4.ren, carid: this.ss4.carid } })
      this.list4 = data.carlist
    },
    async getren() {
      let { data } = await this.axios.get('/renlist', { params: { xiaoqu: this.ss3.xiaoqu, sex: this.ss3.sex, name: this.ss3.name } })
      this.list3 = data.renlist
      this.list33 = data.renlist1
    },
    async getxiaoqu() {
      let { data } = await this.axios.get('/xiaoqulist')
      this.list1 = data.list
      this.list11 = data.list1
    },
    selone(val) {
      this.se1 = val;
    },
    chongzhi() {
      this.ssform = {
        zhanghao: '',
        name: '',
        roleid: '',
      }
    },
  },
  mounted() {
    this.getrole()
    this.getwuzi()
    this.getcar()
    this.getren()
    this.getxiaoqu()
  },
}
</script>

<style></style>